package prac6;

/**
 * Interface for Iterable Sets of a generic datatype 
 * 
 * @author			Menghong Li
 * @author			Ian Moriarty
 * @since			August 2011
 * @input			none
 * @output			none
 * @errorHandling	none
 * @knownBugs		none
 */
public interface Set<T> extends MyIterable<T> {
	/**
	 * Returns a new iterator
	 * 
	 * @returns		A new iterator object
	 */
	Iterator<T> iterator();
	
	/**
	 * Checks if the set is empty
	 * 
	 * @return		Whether the set is empty
	 */
	boolean isEmpty();
	
	/**
	 * Empties the set
	 */
	void clear();
	
	/**
	 * Checks whether item is a member of the set
	 * 
	 * @param		item
	 * @return		Whether item is a member of the set
	 */
	boolean isMember(T item);
	
	/**
	 * Checks whether item is a member of the set and deletes it if found
	 * 
	 * @param		thisItem the item to be deleted
	 * @return		Whether an instance of thisItem was deleted
	 */
	boolean deleteItem(T thisItem);
	
	/**
	 * Finds the size of the set
	 * 
	 * @return		The size of the set
	 */
	int cardinality();
	
	/**
	 * Adds a new item to the set
	 * 
	 * @param		newItem the item to be added to the set
	 * @post		The item has been added to the set
	 */
	void add(T newItem);
	
	/**
	 * Finds the intersection of this set and otherSet
	 * 
	 * @param		otherSet the set we're finding the intersection of this set with
	 * @return		The intersection set
	 */
	LinkedSet<T> intersection(LinkedSet<T> otherSet);
}
